<?php
/*
*后台页面展示
*/ 
/** * * ━━━━━━神兽出没━━━━━━
*       ┌─┐      ┌─┐
*     ┌─┘─┴──────┘─┴─┐
*     │              │
*     │      ─       │
*     │  ┬─┘   └─┬   │
*     │              │
*     │      ┴       │
*     │              │
*     └───┐      ┌───┘
*         │      │Code is far away from bug with the animal protecting ！
*         │      │神兽保佑,代码无bug！ 
*         │      └──────┐
*         │             ├┐
*         │             ┌┘
*         └┐ ┐ ┌───┬─┐ ┌┘
*          │ ┤ ┤   │ ┤ ┤
*          └─┴─┘   └─┴─┘
* ━━━━━━感觉萌萌哒━━━━━━
*/ 
namespace app\admin\controller;
use think\Controller;
use think\Request;
use \think\Db;
class Commit extends Base{
  

	  public function _initialize() {
	    parent::_initialize (); 
	  }


     public function index(){
     	$data = $this->data;
     	$data['ischeck'] = isset($data['ischeck'])?$data['ischeck']:0;

        $where = [
        	"u.del_status"=>0,
        	"u.ischeck"=>$data['ischeck']
        ];
        if(isset($data['role_id']) && !empty($data['role_id'])){
        	$where['u.role_id'] = $data['role_id'];
        }
        if(isset($data['name']) && !empty($data['name'])){
        	$where['u.name'] = $data['name'];
        }
        
        $role_id = isset($data['role_id'])?$data['role_id']:1;
        $ischeck = isset($data['ischeck'])?$data['ischeck']:0;
        $field = "u.id,u.name,u.username,u.phone,u.identify,u.join_money,u.role_id,u.province,u.city,u.district,u.detail,u.ischeck,u.shop_id,r.name as role_name";
     	$list = Db::name(self::$tb["user"])->alias("u")->join("jun_role r","r.id=u.role_id","left")->where($where)->field($field)->paginate(10);
		// $datas = $list->all(); 
  //       foreach ($datas as $key => $value) {  
	 //       $list[$key] = $value;
  //       }  
        $page = $list->render();   
        $this->assign("role_id",$role_id);
        $this->assign("ischeck",$ischeck);
        $this->assign("list",$list);
		$this->assign("list",$list);
		$this->assign("page",$page); 
		return $this->fetch();
     }



  }